﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpenseSystem.Model;
using ExpenseSystem.Lor;
using ExpenseSystem.Common;
using ExpenseSystem.DataUpdater;
using ExpenseSystem.Fether;
using ExpenseSystem.Core.DataAddOn;

namespace ExpenseSystem.Core.DeliveryModules
{
    public class DeliveryBaseManager:DeliveryManager
    {
        DeliveryFetcher fetcher = new DeliveryFetcher();
        public override bool Delete(DeliveryModel Delivery,  out string message)
        {
            if (Delivery.Site != profile.SiteId)
            {
                message = "当前登录的组织与档案所在组织不一致";
                return false;
            }
            bool result = DeliveryUpdater.Remove(Delivery, tran, fetcher, out message);
            return result;
        }

        public override bool DeleteById( long[] DeliveryIds, out string message)
        {
            bool result = true;
            result = DeliveryUpdater.RemoveById( profile.SiteId, DeliveryIds, tran, fetcher, out message);
            return result;
        }

        public override bool Save( DeliveryModel Delivery,  out string message, params IAddable<DeliveryModel>[] addable)
        {
            if (Delivery.Site != profile.SiteId)
            {
                message = "当前登录的组织与档案所在组织不一致";
                return false;
            }
            bool result = true;
            result = DeliveryUpdater.Save( Delivery, tran, fetcher, out message);
            return result;
        }
    }
}
